package feizhou.untils.tools;

import org.apache.log4j.Logger;
import org.json.JSONException;
import org.json.JSONObject;

public class TblJsonUtil {
    private static Logger logger = Logger.getLogger(TblJsonUtil.class);

    public static Integer getInteger(JSONObject jsonObject, String key) {
        Integer value = null;
        try {
            value = jsonObject.getInt(key);
        } catch (JSONException e) {
            logger.error("从json数据中获取" + key + "的值出错，", e);
        }
        return value;
    }

    public static Long getLong(JSONObject jsonObject, String key) {
        Long value = null;
        try {
            value = jsonObject.getLong(key);
        } catch (JSONException e) {
            logger.error("从json数据中获取" + key + "的值出错，", e);
        }
        return value;
    }

    public static String getString(JSONObject jsonObject, String key) {
        String value = null;
        try {
            value = jsonObject.getString(key);
        } catch (JSONException e) {
            logger.error("从json数据中获取" + key + "的值出错，", e);
        }
        return value;
    }

}
